#include"GamePlay.h"

static int CAN_SEE_MAX = 100;

GamePlay::GamePlay(int id, int64_t sock)
{
	m_id = id;
	m_sock = sock;
}

GamePlay::~GamePlay()
{
	m_canSeeMaps.clear();
}

int GamePlay::getId()
{
	return m_id;
}

bool GamePlay::addCanSee(GamePlay* play)
{
	if (getId() == play->getId())
	{
		return false;
	}
	if (m_canSeeMaps.find(play->getId()) != m_canSeeMaps.end())
	{
		return true;
	}
	int count = m_canSeeMaps.size();
	if (count >= CAN_SEE_MAX)
	{
		return false;
	}
	m_canSeeMaps[play->getId()] = play;
	return true;
}

void GamePlay::removeCanSee(GamePlay* play)
{
	m_canSeeMaps.erase(play->getId());
}

int64_t GamePlay::getSock()
{
	return m_sock;
}

std::map<int, GamePlay*>& GamePlay::getCanSees()
{
	return m_canSeeMaps;
}

void GamePlay::setName(std::string name)
{
	m_name = name;
}

std::string GamePlay::getName()
{
	return m_name;
}
